package com.ruoyi.web.controller.system;

import com.ruoyi.system.domain.User;
import com.ruoyi.system.service.impl.UserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class HelloController {
    @Autowired
    private UserServiceImpl userService;

    @GetMapping("/hello")
   public List<User> hello() {return userService.selectAllUser();}

    @PostMapping("/hello/insert")
    public String helloPost(String name,int age ,int sex)
    {
        userService.insertUser(name,age,sex);
        return "update name:" + name + ",age = " + age + ",sex = " + sex;
    }
    @PutMapping("/hello/update")
    public String helloPut(int id,String name,int age,int sex)
    {
        userService.updateUsers(id,name,age,sex);
        return "update name:" + name + ",age = " + age + ",sex = " + sex;
    }
    @DeleteMapping("/hello/{name}")
    public String helloDle(@PathVariable String name)
    {
        userService.deleteName(name);
        return "delete name:" + name;
    }
}